package com.yachang.qym.usbhost.utils;

import java.text.DecimalFormat;

/**
 * Created by qym on 2017/1/6.
 */

public class DistanceDTSUtil {
    public static String getDistance(double distance) {
        boolean isMoreThan1000 = false;
        if(distance > 1000){
            isMoreThan1000 = true;
            distance = distance/1000;
        }
        DecimalFormat df = new DecimalFormat("######0.00");
        String trueDistance = df.format(distance);
        if(isMoreThan1000){
            return trueDistance + "公里";
        } else {
            return trueDistance + "米";
        }
    }
}
